package com.ytf.test.seventh;

/**
 * @author: YTF
 * @date: 2024/9/27 13:21
 * @version: 1.0
 * @description:
 */
public class PlaceSetting extends Custom {
    private Spoon spoon;
    private Fork fork;
    private Knife knife;
    private DinnerPlate dinnerPlate;

    public PlaceSetting(int i) {
        super(i+1);
        spoon = new Spoon(i+2);
        fork = new Fork(i+3);
        knife = new Knife(i+4);
        dinnerPlate = new DinnerPlate(i+5);
        System.out.println("PlaceSetting constructor");
    }

    public static void main(String[] args) {
        PlaceSetting placeSetting = new PlaceSetting(9);
        /**
         * Output:
         * Custom(int i) constructor
         * Utensil(int i) constructor
         * Spoon(int i) constructor
         * Utensil(int i) constructor
         * Fork(int i) constructor
         * Utensil(int i) constructor
         * Knife(int i) constructor
         * Plate(int i) constructor
         * DinnerPlate constructor
         * PlaceSetting constructor
         */
    }
}
class Custom{
    public Custom() {
        System.out.println("Custom constructor");
    }
    public Custom(int i) {
        System.out.println("Custom(int i) constructor");
    }
}
class Plate{
    public Plate() {
    }
    public Plate(int i) {
        System.out.println("Plate(int i) constructor");
    }
}
class DinnerPlate extends Plate{
    public DinnerPlate(int i) {
        super(i);
        System.out.println("DinnerPlate constructor");
    }
}
class Utensil{
    public Utensil() {
    }
    public Utensil(int i) {
        System.out.println("Utensil(int i) constructor");
    }
}
class Spoon extends Utensil{
    public Spoon(int i) {
        super(i);
        System.out.println("Spoon(int i) constructor");
    }
}
class Fork extends Utensil{
    public Fork(int i) {
        super(i);
        System.out.println("Fork(int i) constructor");
    }
}
class Knife extends Utensil{
    public Knife(int i) {
        super(i);
        System.out.println("Knife(int i) constructor");
    }
}

